package com.sohu.sip.group.impl;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.sohu.sip.group.GroupBus;
import com.sohu.sip.group.GroupBusListener;


/**
 * 
 * ʧЧ֪ͨ
 */
public class GroupBusImpl extends BroadcastingListener implements GroupBus {
	/**
	 * Logger for this class
	 */
	private static final Log log = LogFactory.getLog(GroupBusImpl.class);



	/**
	 * 
	 */
	public void flushEntry(String region, String key) {
		if (log.isDebugEnabled()) {
			log.debug("flushEntry(region = " + region + ", key = " + key + ")");
		}

		ClusterNotification notify = new ClusterNotification(
				ClusterNotification.FLUSH_KEY, region, key);
//		bus.sendNotification(notify);		
		sendNotification(notify);

	}

	/**
	 * 
	 */
	public void flushGroup(String region, String key) {
		if (log.isDebugEnabled()) {
			log.debug("flushGroup(region = " + region + ", key = " + key + ")");
		}

		ClusterNotification notify = new ClusterNotification(
				ClusterNotification.FLUSH_GROUP, region, key);
//		bus.sendNotification(notify);		
		sendNotification(notify);
	}
	
	/**
	 * 
	 */
	public void addEventListener(String region, GroupBusListener listener) {
		listenerMap.put(region, listener);
	}
	

}